﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

public partial class Module_DetailFlightIn : PanelControl
{
    private int id = Helper.getQuery("flightID");
    FlightBusiness fl = new FlightBusiness();
    CityBusiness cb = new CityBusiness();
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            bindGV();
            bindDV1();
            bindDV2();
        }
    }

    public void bindGV()
    {
        GridView1.DataSource = fl.getFlightDataTable(id);
        GridView1.DataBind();
    }

    public void bindDV1()
    {
        DataTable dt=fl.getFlightDataTable(id);
        DataRow dr = dt.Rows[0];
        DetailsView1.DataSource = cb.getIntroduction(dr["departure"].ToString());
        DetailsView1.DataBind();
    }

    public void bindDV2()
    {
        DataTable dt = fl.getFlightDataTable(id);
        DataRow dr = dt.Rows[0];
        DetailsView2.DataSource = cb.getIntroduction(dr["arrival"].ToString());
        DetailsView2.DataBind();
    }
    protected void lbDV_Click(object sender, EventArgs e)
    {
        FlightEntities fe=fl.getFlight(id);
        BookingEntities be = new BookingEntities();
        be._ngaydi = fe._departureDate;
        be._noidi = fe._departure;
        be._noiden = fe._arrival;
        be._khuhoi = "False";
        Session["datve"] = be;
        Response.Redirect("Default.aspx?url=Module/SelectFlight.ascx");
    }
}